<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <!--{include file='comm/header.tpl'}-->
    <title><!--{if $specGroupInfoe->specGroupID !='' }-->修改规格组<!--{else}-->添加规格组<!--{/if}--></title>
</head>

<body>
<div style="width:100%">

    <div class="items clearfix">
        <h2 style="" class="tal">正在操作：<!--{if $specGroupInfoe->specGroupID !='' }-->修改规格组<!--{else}-->添加规格组<!--{/if}--></h2>
        <div class="items2">
            <!--{if $error_msg}-->
	            <div class="error-box">
	                <!--{$error_msg}-->
	            </div>
            <!--{else}-->
            <div>
                <form id="specGroup_form" onsubmit="return false;">
                    <table>
                        <tbody>
                        <tr>
                            <td class="tar" width="150">规格组名称：</td>
                            <td width="400">
                            	<input type="text" style="ime-mode:active;width:300px;" autocomplete="off"  name="specGroupName" id="specGroupName" maxlength="20" value="<!--{$specGroupInfoe->specGroupName}-->">
                                <font color="red">*</font>
                                 <input type="hidden" name="specGroupID" id="specGroupID" value="<!--{$specGroupInfoe->specGroupID}-->" />
                            </td>
                        </tr>
                         <tr>
                            <td class="tar">排列序号：</td>
                            <td>
                            	<input type="text" style="ime-mode:active;width:80px;" autocomplete="off"  name="sortOrder" id="sortOrder" maxlength="6" value="<!--{if $specGroupInfo}--><!--{$specGroupInfo->sortOrder}--><!--{else}--><!--{$specGroupInfoe->sortOrder}--><!--{/if}-->">
                                <font color="red">*</font>
                            </td>
                        </tr>
                        <tr>
                        	<td class="tar">一级规格：</td>
                        	<td>
                        	<!--{if $specGroupInfoe}-->	
                        		<!--{if $specGroupInfoe->isColor == 1}-->
                        			<input type="radio" name="isColor" value="1" checked>是
	                        		<input type="radio" name="isColor" value="0">否
                        		<!--{else}-->
                        			<input type="radio" name="isColor" value="1">是
	                        		<input type="radio" name="isColor" value="0" checked>否	
	                        	<!--{/if}-->
	                        <!--{else}-->
	                        		<input type="radio" name="isColor" value="1">是
	                        		<input type="radio" name="isColor" value="0" checked>否
	                        <!--{/if}-->		
                        	</td>
                        </tr>
                           <tr>
                        	<td class="tar">使用标志：</td>
                        	<td>
                        	<!--{if $specGroupInfoe}-->	
                        		<!--{if $specGroupInfoe->useFlg == 1}-->
                        			<input type="radio" name="useFlg" value="1" checked>启用
	                        		<input type="radio" name="useFlg" value="0">禁用
                        		<!--{else}-->
                        			<input type="radio" name="useFlg" value="1">启用
	                        		<input type="radio" name="useFlg" value="0" checked>禁用	
	                        	<!--{/if}-->
	                        <!--{else}-->
	                        		<input type="radio" name="useFlg" value="1" checked>启用
	                        		<input type="radio" name="useFlg" value="0">禁用
	                        <!--{/if}-->		
                        	</td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <!--{/if}-->

        </div>
    </div>
    <div class="bottom_fixbox">
        <div class="rectbox tac">
        	<input type="button" class="btn" onclick="specGroup.check();" value="<!--{if $specGroupInfoe->specGroupID !='' }-->修改规格组<!--{else}-->添加规格组<!--{/if}-->" />&nbsp;&nbsp;&nbsp;
            <input type="button" class="btn" onclick="E.closeWindows();" value="关闭" />
        </div>
    </div>

</div>

<script type="text/javascript"> 
    var specGroup = {
        specGroupID: <!--{$specGroupInfo->specGroupID|default:0}-->,
        //检查数据
        check: function() {
            this.dt = E.getFormValues("specGroup_form");
            var error_msg = "";
            if (this.dt.specGroupName == "")
                error_msg += "规格组名称不能为空<br />";
                
            if (!E.isInt(this.dt.sortOrder))
                error_msg += "排序序号必须为数字<br />";
                
            if (error_msg != "")
                E.alert(error_msg);
             else
                specGroup.add() ;
        },

        //保存规格组信息
        add: function() {
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/goods/specGroup.ajax?operFlg=2" ,
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {
                        if(specGroup.specGroupID == 0){
                        	E.opener("specGroup.load");
                        	E.alert(result_obj.message, 2);
                        	//self.location = "/quanliadmin/app/goods/specGroup.pscript?operFlg=2" ;
                        }else{
                        	E.alert(result_obj.message, 2, "E.closeWindows");
                        	E.opener("specGroup.load");
                        }
                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        },

    };
</script>
</body>
</html>